# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key.

# Make sure your secret_key_base is kept private
# if you're sharing your code publicly.
# SampleApp::Application.config.secret_key_base = 'da69f39869be6762e3d387b3ff1ddc8cff4c50cd47777f58c3d220bebd5d455ba4f1bd7e08d6993737e44cc11633673eddb96ccaecc34c5e7ca304a14d338100'
require 'securerandom'

def secure_token
   token_file = Rails.root.join('.secret')
   if File.exist?(token_file)
       File.read(token_file).chomp
   else
       token = SecureRandom.hex(64)
       File.write(token_file, token)
       token
   end
end

SampleApp::Application.config.secret_key_base = secure_token  
